/* 📱 PWA移动端优化样式 - 精英杂志 */

/* 🎯 安装按钮样式 */
#pwa-install-button {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    background: linear-gradient(135deg, #1e3a8f, #3b82f6) !important;
    color: white !important;
    padding: 12px 20px !important;
    border-radius: 25px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(30, 58, 143, 0.3) !important;
    z-index: 9999 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

#pwa-install-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(30, 58, 143, 0.4) !important;
}

#pwa-install-button:active {
    transform: translateY(0) !important;
}

/* 🔄 更新通知样式 */
#pwa-update-notification {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    padding: 15px 20px !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3) !important;
    z-index: 9999 !important;
    font-size: 14px !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    max-width: 320px !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    animation: slideInRight 0.3s ease-out !important;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 📱 移动端优化 */
@media (max-width: 768px) {
    /* 安装按钮移动端适配 */
    #pwa-install-button {
        bottom: 15px !important;
        right: 15px !important;
        padding: 10px 16px !important;
        font-size: 13px !important;
        border-radius: 20px !important;
    }
    
    /* 更新通知移动端适配 */
    #pwa-update-notification {
        top: 15px !important;
        right: 15px !important;
        left: 15px !important;
        max-width: none !important;
        font-size: 13px !important;
        padding: 12px 16px !important;
    }
    
    /* 导航栏优化 */
    .navbar {
        padding: 0.5rem 1rem !important;
    }
    
    .navbar-brand {
        font-size: 1.1rem !important;
    }
    
    /* 主内容区域优化 */
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    main.container {
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
    }
}

@media (max-width: 480px) {
    /* 超小屏幕优化 */
    #pwa-install-button {
        bottom: 10px !important;
        right: 10px !important;
        font-size: 12px !important;
        padding: 8px 14px !important;
    }
    
    #pwa-update-notification {
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        font-size: 12px !important;
    }
}

/* 🌟 PWA安装后优化 */
@media (display-mode: standalone) {
    /* 隐藏浏览器UI时的优化 */
    body {
        padding-top: env(safe-area-inset-top) !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
    
    /* 导航栏优化 */
    .navbar {
        padding-top: calc(0.5rem + env(safe-area-inset-top)) !important;
    }
    
    /* 安装按钮位置调整 */
    #pwa-install-button {
        bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    }
}

/* 🍎 iOS特定优化 */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari优化 */
    .navbar {
        padding-top: calc(0.5rem + 20px) !important;
    }
    
    #pwa-install-button {
        bottom: calc(20px + 20px) !important;
    }
}

/* 🌈 按钮样式优化 */
.pwa-button {
    background: linear-gradient(135deg, #1e3a8f, #3b82f6) !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(30, 58, 143, 0.2) !important;
}

.pwa-button:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(30, 58, 143, 0.3) !important;
}

/* ⚡ 加载动画 */
.pwa-loading {
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
    border: 3px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important;
    border-top-color: white !important;
    animation: spin 1s ease-in-out infinite !important;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 🎯 触摸反馈 */
.pwa-touch-feedback {
    position: relative !important;
    overflow: hidden !important;
}

.pwa-touch-feedback:active::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 0 !important;
    height: 0 !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.3) !important;
    transform: translate(-50%, -50%) !important;
    animation: ripple 0.6s ease-out !important;
}

@keyframes ripple {
    to {
        width: 200px !important;
        height: 200px !important;
        opacity: 0 !important;
    }
}